#!/bin/bash
ev_pwd=$(pwd)
mkdir $ev_pwd/out
cd $ev_pwd/out
cp -raf ./* $ev_pwd/
cd $ev_pwd
make
cp ./debug ./out -r
cp ./display ./out -r
cp ./draw ./out -r
cp ./encoding ./out -r
cp ./file ./out -r
cp ./fonts ./out -r
cp ./include ./out -r
cp ./input ./out -r
cp ./page ./out -r
cp ./render ./out -r
cp ./* ./out/
cp ./.Main.o.d ./out 
cd ./out/
rm mk
rm photo_frame
find ./ -name "*.h" -exec rm -rf {}  \;
find ./ -name "*.c" -exec rm -rf {}  \;
find ./ -name "Makefile" -exec rm -rf {}  \;
find ./ -name "Makefile.build" -exec rm -rf {}  \;

cd $ev_pwd
find ./ -path "./out" -prune -o -name "*.o" -exec rm -rf {} \;
find ./ -path "./out" -prune -o -name "*.o.d" -exec rm -rf {} \;
